package com.administrators.services;

import com.administrators.dao.AdmsDao;
import com.administrators.entity.Adms;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Scope("prototype")
public class AdmsSercicesImpl implements AdmsServices {
    @Autowired
    private AdmsDao admsDao = null;
    @Transactional
    public boolean addone(Adms adms) {
        boolean flag = admsDao.addone(adms);
        return flag;
    }
    @Transactional
    public Adms selectone(Adms adms) {
        Adms adms1 = admsDao.selectone(adms);
        return adms1;
    }
    @Transactional
    public boolean updateone(Adms adms) {
        boolean flag = admsDao.updateone(adms);
        return flag;
    }
    @Transactional
    public boolean deleteone(Adms adms) {
        boolean flag = admsDao.deleteone(adms);
        return flag;
    }

    public Adms login(Adms adms) {
        Adms adms1 = admsDao.selectone(adms);
        if (adms.getName().equals(adms1.getName())&&adms.getPwd().equals(adms1.getPwd())){
        return adms1;
         }else{
            return null;
        }
    }
}
